/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package herramientas;

import java.sql.*;

/**
 *
 * @author javier
 */
public class username {
	


public boolean username(String user){
	String url = "jdbc:postgresql://localhost/upas_db";
		try {
			Class.forName("org.postgresql.Driver");
			Connection con = DriverManager.getConnection(url, "upas", "upasadmin");
			Statement state = con.createStatement();
			String query = "SELECT username FROM usuario WHERE username='"+user+"'";
			ResultSet users = state.executeQuery(query);
			
			boolean existe = users.next(); 
			return existe;
			
		} catch (Exception e) {

			System.out.println(e.getMessage());
			return false;

		}

	
	}
}